Conversation
WalkthroughTests expanded to validate fetch-reason propagation across interfaces and implementing types; RootNodes metadata no longer includes FetchReasonFields. Visitor replaced inline propagation with a new helper that deduplicates, merges, and extends fetch reasons to object/interface fields. A doc comment in resolve/fetch.go was adjusted. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)v2/pkg/engine/plan/visitor.go (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (2)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
v2/pkg/engine/plan/visitor.go (1)
1529-1621: Propagates interface/object reasons correctly; add BySubgraphs dedup/sortLogic covers:
- Direct lookup match,
- Object field via interface-marked fallback,
- Interface → all implementing types (or only those in lookup).
Dedup via FieldCoordinate index is solid.Missing: after merges, BySubgraphs may contain duplicates and non-deterministic order. Sort+compact for each reason (as in buildFetchReasons) to keep payload stable.
Apply this at the end of the function:
func (v *Visitor) getPropagatedReasons(fetchID int, fetchReasons []resolve.FetchReason) []resolve.FetchReason { @@ - slices.SortFunc(propagated, cmpFetchReasons) + // Normalize merged subgraph lists for determinism + for i := range propagated { + if len(propagated[i].BySubgraphs) > 0 { + slices.Sort(propagated[i].BySubgraphs) + propagated[i].BySubgraphs = slices.Compact(propagated[i].BySubgraphs) + } + } + slices.SortFunc(propagated, cmpFetchReasons) return propagated }execution/engine/execution_engine_test.go (1)
1096-1166: Consider adding a BySubgraphs merge testYou test dedupe across interface/implementing reasons. Add one case where a coordinate is requested by multiple subgraphs to assert BySubgraphs is deduped and sorted (e.g., ["a","b","b"] → ["a","b"]). This hardens determinism of extensions.fetch_reasons.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
execution/engine/execution_engine_test.go(3 hunks)v2/pkg/engine/plan/visitor.go(4 hunks)v2/pkg/engine/resolve/fetch.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
v2/pkg/engine/plan/visitor.go (3)
v2/pkg/engine/resolve/fetch.go (1)
FetchReason(364-372)v2/pkg/engine/plan/federation_metadata.go (1)
FieldCoordinate(89-92)pkg/ast/ast_node_kind.go (2)
NodeKindObjectTypeDefinition(14-14)NodeKindInterfaceTypeDefinition(16-16)
execution/engine/execution_engine_test.go (3)
v2/pkg/engine/plan/datasource_configuration.go (2)
DataSourceMetadata(34-59)DataSource(274-287)v2/pkg/engine/plan/type_field.go (1)
TypeField(3-8)v2/pkg/engine/datasource/graphql_datasource/configuration.go (3)
ConfigurationInput(16-23)FetchConfiguration(124-128)SchemaConfiguration(135-139)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build and test (go 1.25 / windows-latest)
- GitHub Check: Build and test (go 1.25 / ubuntu-latest)
- GitHub Check: Build and test (go 1.25 / windows-latest)
- GitHub Check: Build and test (go 1.25 / ubuntu-latest)
🔇 Additional comments (6)
v2/pkg/engine/resolve/fetch.go (1)
362-372: Docstring alignment looks goodComment reflects (TypeName, FieldName) coordinates and matches struct fields and JSON keys.
v2/pkg/engine/plan/visitor.go (4)
1351-1352: Correct placement of propagated reasons assignmentSetting PropagatedFetchReasons only when FetchReasons exist is safe and avoids nils.
1421-1423: Index by FieldCoordinate is appropriateUsing a typed key improves safety and avoids stringly-typed map keys. Good.
1505-1506: Deterministic ordering via cmpFetchReasonsSwitch to a reusable comparator improves consistency.
1509-1515: cmpFetchReasons is correct and minimalLexicographic TypeName, then FieldName comparison is sufficient for stable ordering.
execution/engine/execution_engine_test.go (1)
846-904: Great coverage for interface propagation to implementing typesValidates Character.name marking → Character, Droid, Human reasons and POST body composition. LGTM.
… yury/eng-8266-support-requirefetchreasons-on-interface-fields
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
v2/pkg/engine/plan/visitor.go(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v2/pkg/engine/plan/visitor.go (3)
v2/pkg/engine/resolve/fetch.go (1)
FetchReason(364-372)v2/pkg/engine/plan/federation_metadata.go (1)
FieldCoordinate(89-92)pkg/ast/ast_node_kind.go (2)
NodeKindObjectTypeDefinition(14-14)NodeKindInterfaceTypeDefinition(16-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build and test (go 1.25 / windows-latest)
- GitHub Check: Build and test (go 1.25 / ubuntu-latest)
- GitHub Check: Build and test (go 1.25 / ubuntu-latest)
- GitHub Check: Build and test (go 1.25 / windows-latest)
🔇 Additional comments (4)
v2/pkg/engine/plan/visitor.go (4)
1351-1351: LGTM!The integration of the new
getPropagatedReasonshelper is clean and appropriate.
1421-1422: LGTM!The comment clearly explains the purpose of the index map.
1505-1505: LGTM!Good refactor to use the shared
cmpFetchReasonshelper for consistency.
1509-1514: LGTM!The comparison logic is correct and idiomatic. It properly compares by TypeName first, then FieldName for consistent sorting.
🤖 I have created a release *beep* *boop* --- ## [2.0.0-rc.230](v2.0.0-rc.229...v2.0.0-rc.230) (2025-10-09) ### Bug Fixes * avoid duplicate joins on errors ([#1314](#1314)) ([a1f1f8c](a1f1f8c)) * propagate fetch reasons for interface-related fields ([#1312](#1312)) ([5ee3014](5ee3014)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Prevent duplicate joins when errors occur, improving stability. * Propagate fetch reasons for interface-related fields for more accurate behavior and diagnostics. * **Documentation** * Added changelog entry for version 2.0.0-rc.230. * **Chores** * Bumped version to 2.0.0-rc.230. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🤖 I have created a release *beep* *boop* --- ## [1.6.0](execution/v1.5.0...execution/v1.6.0) (2025-10-21) ### Features * support the oneOf directive ([#1308](#1308)) ([251cb02](251cb02)) * validate presence of optional [@requires](https://github.com/requires) dependencies ([#1297](#1297)) ([ba75e25](ba75e25)) ### Bug Fixes * bump engine to v2.0.0-rc.231 for execution ([#1329](#1329)) ([ebddb25](ebddb25)) * propagate fetch reasons for interface-related fields ([#1312](#1312)) ([5ee3014](5ee3014)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added oneOf directive support * Added validation of optional @requires dependencies * **Bug Fixes** * Fixed fetch reason propagation for interface-related fields <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Interfaces were not handled before at all.
Now, if interface field is marked with special directive,
then fields on implementing type are considered as marked too.
You can find more details in the comments.
Summary by CodeRabbit
Bug Fixes
Tests
Refactor
Chores (breaking)